-- @owner: ningyali
-- @date: 2024-08-12
-- @testpoint: 验证分区表查询是否支持序列

--step1: 创建范围分区表测试表并插入数据; expect: 创建范围分区表测试表并插入数据成功
drop table if exists t_ustore_partition_0012 cascade;
create table t_ustore_partition_0012(id number,time date)
with (storage_type=ustore) partition by range (time)
(partition t1 values less than (to_date('2010-10-1', 'yyyy-mm-dd')),
partition t2 values less than (to_date('2010-11-1', 'yyyy-mm-dd')),
partition t3 values less than (to_date('2010-12-1', 'yyyy-mm-dd')),
partition t4 values less than (maxvalue)
);

--step2: 创建序列并向表中插入数据; expect: 创建序列并向表中插入数据成功
drop sequence if exists seq_ustore_partition_0012;
create sequence seq_ustore_partition_0012 increment by 1 start with 1;
insert into t_ustore_partition_0012 values(seq_ustore_partition_0012.nextval,null);
insert into t_ustore_partition_0012 values(seq_ustore_partition_0012.nextval,null);
insert into t_ustore_partition_0012 values(seq_ustore_partition_0012.nextval,null);

--step3: 查看表数据; expect: 有三条数据
select * from t_ustore_partition_0012 order by id,time;

--step4: 清理环境; expect: 清理环境成功
drop table if exists t_ustore_partition_0012 cascade;
drop sequence if exists seq_ustore_partition_0012;